gh-109598: make PyComplex_RealAsDouble/ImagAsDouble use __complex__#109647
Merged
Conversation
skirpichev
force-pushed
the
complex-realimag-asdouble
branch
from
September 21, 2023 11:25
793c54f to
946e547
Compare
…ex__ * PyComplex_ImagAsDouble() also will not silently return 0.0 for non-complex types anymore. Instead we try to call PyFloat_AsDouble() and return 0.0 only if this call is successful. * Full test coverage for changed functions.
skirpichev
force-pushed
the
complex-realimag-asdouble
branch
from
September 21, 2023 12:39
8a9d9dd to
0e07b65
Compare
Ogb-Bassey
reviewed
Oct 6, 2023
Member
Author
|
CC @mdickinson as suggested by https://devguide.python.org/experts/ |
This was referenced Oct 31, 2023
Closed
This comment was marked as resolved.
This comment was marked as resolved.
skirpichev
marked this pull request as draft
November 2, 2023 03:17
skirpichev
marked this pull request as ready for review
November 5, 2023 11:14
This comment was marked as resolved.
This comment was marked as resolved.
Member
Author
encukou
approved these changes
Jan 15, 2024
kulikjak
pushed a commit
to kulikjak/cpython
that referenced
this pull request
Jan 22, 2024
…ex__ (pythonGH-109647) `PyComplex_RealAsDouble()`/`PyComplex_ImagAsDouble` now try to convert an object to a `complex` instance using its `__complex__()` method before falling back to the ``__float__()`` method. PyComplex_ImagAsDouble() also will not silently return 0.0 for non-complex types anymore. Instead we try to call PyFloat_AsDouble() and return 0.0 only if this call is successful.
aisk
pushed a commit
to aisk/cpython
that referenced
this pull request
Feb 11, 2024
…ex__ (pythonGH-109647) `PyComplex_RealAsDouble()`/`PyComplex_ImagAsDouble` now try to convert an object to a `complex` instance using its `__complex__()` method before falling back to the ``__float__()`` method. PyComplex_ImagAsDouble() also will not silently return 0.0 for non-complex types anymore. Instead we try to call PyFloat_AsDouble() and return 0.0 only if this call is successful.
Glyphack
pushed a commit
to Glyphack/cpython
that referenced
this pull request
Sep 2, 2024
…ex__ (pythonGH-109647) `PyComplex_RealAsDouble()`/`PyComplex_ImagAsDouble` now try to convert an object to a `complex` instance using its `__complex__()` method before falling back to the ``__float__()`` method. PyComplex_ImagAsDouble() also will not silently return 0.0 for non-complex types anymore. Instead we try to call PyFloat_AsDouble() and return 0.0 only if this call is successful.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PyComplex_ImagAsDouble() also will not silently return 0.0 for non-complex types anymore. Instead we try to call PyFloat_AsDouble() and return 0.0 only if this call is successful.
📚 Documentation preview 📚: https://cpython-previews--109647.org.readthedocs.build/